import request from '../index.js';

// 阅读绘本
export const read = (bookId) => {
	return request.get("/api/user/book/read", {
		bookId
	})
}

// 确认阅读完成绘本
export const markRead = (bookId) => {
	return request.get("/api/user/book/markRead", {
		bookId
	})
}

// 获取阿里云OSS上传STS凭据
export const getOssKeySecret = (params = {}) => {
	return request.get('/api/user/upload/getOssKeySecret')
}
// 获取阿里云OSS预签名上传凭据
export const getDirectUploadToken = (fileName) => {
	return request.get('/api/user/upload/getDirectUploadToken', {
		fileName
	});
}

// oSS上传录音
export const uploadFile = (url, options) => {
	return request.uploadFile(url, options, {
		noUrl: true,
		noAuth: true,
		noVerify: true
	}, {
		'content-type': 'multipart/form-data'
	});
}

// 上传录音路径
export const recording = (bookId, page, audio) => {
	return request.post('/api/user/recording/upload', {
		bookId,
		page,
		audio
	})
}


// 收藏
export const collect = (bookId) => {
	return request.get('/api/user/collection/collect', {
		bookId
	})
}
// 删除收藏
export const remove = (bookId) => {
	return request.get('/api/user/collection/remove', {
		bookId
	});
}

